# -*- coding: utf-8 -*-
"""
Created on Thu Oct 03 14:31:36 2013

@author: jkwong
"""

import matplotlib.pyplot as plt
import glob
import os
from matplotlib import cm
import numpy as np

# PBAR_CreateBasicZspecDiagnosticImages.py

baseDir = r'C:\Users\jkwong\Documents\Work\PBAR\data3\npy'

# create  filelist
fullFilenameList = glob.glob(os.path.join(baseDir, r'*.npy'))

filenameList = []
for f in fullFilenameList:
    a, b = os.path.split(f)
    filenameList.append(b)

# cycle through the files
for (index, f) in enumerate(fullFilenameList):
    
    print("Working on %s" %f)
    dat = np.load(f)
    # Plot
    plt.figure(figsize = (16, 10))
    plt.grid()
    
    # sasve to png file

    plt.title(filenameList[index])

#    plt.imshow(dat.T, interpolation = 'nearest', aspect='auto', cmap = cm.Greys_r)
    plt.imshow(dat.T, interpolation = 'nearest', aspect='auto', cmap = cm.Greys_r)
    
    savefig(f.replace('.npy', '.png'))
    
    plt.close("all")